<!DOCTYPE html>
<html>
  <head>
    <title>Chaskiq App</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <link rel="icon" type="image/png" href="<%= asset_url('favicon.png') %>" sizes="16x16">

    <meta content='True' name='HandheldFriendly'>
    <meta content='320' name='MobileOptimized'>
    <meta name="chaskiq-host" content="<%= ENV['HOST'] %>"/>

    <!--
    <meta content='width=device-width, initial-scale=1' name='viewport'>
    <meta content='width=device-width, initial-scale=1' media='(device-height: 568px)' name='viewport'>
    -->
    <meta
      name="viewport"
      content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
    >
    <!--<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/antd/3.5.4/antd.css">-->

    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.css' rel='stylesheet' />

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">

    <script src='https://api.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.js'></script>
    <link href='https://api.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.css' rel='stylesheet' />

    <script> window.chaskiq_cable_url = "<%= ENV['WS'] %>"</script>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>


    <%= stylesheet_pack_tag "application" %> 
    <%= javascript_pack_tag 'application' %>
    <!--<link href="https://fonts.googleapis.com/css?family=PT+Sans|Roboto+Mono&display=swap" rel="stylesheet">-->
    <!--<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,500,500i,600,600i,700,700i&amp;subset=latin-ext" rel="stylesheet">-->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,500,700,800&display=swap" rel="stylesheet">
  </head>

  <body>
    <div class="page" id="main-page">
    </div>

    <% if enabled_subscriptions? %>
      <script src="https://cdn.paddle.com/paddle/paddle.js"></script>
      <script type="text/javascript">
        Paddle.Setup({ vendor: 115475 });
      </script>
    <% end %>

    <% if current_agent.present? and
      support_data = support_app_data and
      support_data.present? %> 

      <script>
        (function(d,t) {
          var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
          g.src="<%=ENV['HOST']%>/embed.js"
          s.parentNode.insertBefore(g,s);
          g.onload=function(){
            new window.ChaskiqMessengerEncrypted({
              domain: "<%= ENV['HOST'] %>",
              ws:  "<%= ENV['WS'] %>",
              app_id: "<%= support_app_data[:app].key %>",
              data: "<%= support_app_data[:enc] %>"
            })
          }
        })(document,"script");
      </script>

    <% end %>
  </body>
</html>
